// 编程实现顺序表的逆置

#include <iostream>

using namespace std;

//首尾交换即可
void reverse(int arr[],int n)
{
    for(int i =0,j=n-1;i<j;i++,j--)
    {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
}
void show(int arr[],int n)
{
    for(int i = 0;i<n;i++)
    {
        cout<<arr[i]<<",";
    }
}
int main()
{
    int arr[] = {1,2,3,4,5,6,7};
    reverse(arr,7);
    show(arr,7);
    cout<<endl;
    system("pause");
    return 0;
}
